<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>社医堂</title>
<link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/hui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/iconfont.css" />
</head>
<style>
body{background-color: #fff;}
#health{width:100%}
#health li{float:left;text-align:center;height:36px;line-height:36px;background-color:#7BCAFF;}
.hui-segment-active2{background-color:#45b3fc !important;}
</style>
<body>
<header class="hui-header">
    <div id="hui-back"></div>
    <h1>测量数据上报记录</h1>
	<div id="hui-header-menu" onclick="showupdata()"></div>
</header>
<div class="hui-wrap" style="margin-top:27px;">
	<div style="padding:0px;margin:0px;">
		<ul id="health">
			
		</ul>
	</div>

</div>


<footer id="hui-footer"></footer>

<script src="../../../script/hui.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/hui-tab.js" type="text/javascript"></script>
<script src="../../../script/api.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../script/stm.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
apiready=function(){	

	var id = api.pageParam.id;
	var header = $api.dom('header');
	var headerH = $api.fixStatusBar(header);
	var footer = $api.dom('footer');
	var footerH = $api.fixTabBar(footer);
	var mainheight = api.winHeight-footerH-headerH;
	//document.getElementById("footer").style.marginTop = mainheight;


	setfooter(0)
	health(headerH,mainheight)	

}

function health(headerH,mainheight){

	$api.setStorage('healthnum',0)
	if($api.getStorage('health')!='' && $api.getStorage('health')!=null){
		var health = $api.getStorage('health')+'';
	}else{
		var health = '血压,血脂,血糖,慢性肺阻';
	}

	var healthArr = health.split(",")
	var html = '';
	var width = 100/healthArr.length
	$api.setStorage('healthnum',healthArr.length)
	
	for(i=0;i<healthArr.length;i++){
		var bg = '';
		if(i==0){ bg = 'hui-segment-active2'; }
		html += "<li id='menu_"+i+"' onclick=tab('"+healthArr[i]+"',"+i+") style='width:"+width+"%;' class='"+bg+"'>"+healthArr[i]+"</li>"
	}
	hui("#health").html(html)

	api.openFrame({
		name: 'up_record_frm',
		url:'up_record_frm.html',
		pageParam:{v:healthArr[0],i:0},
		rect: {
			x: 0,
			y: headerH+36,
			w: 'auto',
			h: mainheight-40
		}
	})
	
}

function tab(v,i){

	for(var a=0;a<4;a++){
		if(i==a){
			hui("#menu_"+a).addClass("hui-segment-active2");
		}else{
			hui("#menu_"+a).removeClass("hui-segment-active2");
		}
	}
	
	api.execScript({
		//name: 'up_record_win',
		frameName: 'up_record_frm',
		script: 'list("'+v+'",'+i+');'
	});

}


</script>

</body>
</html>